use clap::Parser;

mod channel;
mod cli;
mod server;
mod util;

#[derive(Parser)]
struct CliCmd {
    #[arg(long = "cli", short = 'C', required = false, default_value = "false")]
    cli: bool,
    #[arg(long = "server", short = 'S', required = false, default_value = "false")]
    server: bool,
}

fn main() {
    let args = CliCmd::parse();
    if args.server && !args.cli {
        println!("=====> 启动服务端");
        server::start();
    } 
    if args.cli && !args.server {
        // 连接服务器
        println!("=====> 启动终端");
        cli::requestor::connect_server();
    }
    if !args.server && !args.cli {
        println!("请选择执行终端程序或者服务端程序！");
    }
    if args.server && args.cli {
        println!("不能同时执行终端程序或者服务端程序！");
    }
}

